static-lib=libmath.a
dynamic-lib=libmymethod.so

.PHONY:all
all:$(static-lib) $(dynamic-lib)

$(static-lib):math.o
	ar -rc $@ $^
math.o:math.cc
	g++ -c $^

$(dynamic-lib):mylog.o myprint.o
	g++ -shared -o $@ $^
mylog.o:mylog.cc
	g++ -fPIC -c $^
myprint.o:myprint.cc
	g++ -fPIC -c $^

.PHONY:clean
clean:
	rm -rf *.o *.a *.so lib

.PHONY:output
output:
	mkdir -p mylib/include
	mkdir -p mylib/lib
	cp *.hpp mylib/include
	cp *.a mylib/lib
	cp *.so mylib/lib
